<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8"/>
    <title>分配权限 - bjyadmin</title>
    <link href="__ADMINCSS__/bootstrap.min.css" rel="stylesheet">
    <link href="__ADMINCSS__/font-awesome.css" rel="stylesheet">
    <link href="__ADMINCSS__/animate.css" rel="stylesheet">
    <link href="__ADMINCSS__/style.css" rel="stylesheet">
    <link href="__ADMINCSS__/plugins/treeview/bootstrap-treeview.css" rel="stylesheet">
</head>
<body>
<h1 class="text-center">为<span style="color:red">{$group_data['title']}</span>分配权限</h1>
<form action="" method="post">
    <input type="hidden" name="id" value="{$group_data['id']}">
    <table class="table table-striped table-bordered table-hover table-condensed
	">
        <foreach name="rule_data" item="v">
            <empty name="v['_data']">
                <tr class="b-group">
                    <th width="10%">
                        <label>
                            {$v['title']}
                            <input type="checkbox" name="rule_ids[]" value="{$v['id']}" <if condition="in_array($v['id'],$group_data['rules'])">	checked="checked"</if> onclick="checkAll(this)" >
                        </label>
                    </th>
                    <td></td>
                </tr>
                <else />
                <tr class="b-group">
                    <th width="10%">
                        <label>
                            {$v['title']} <input type="checkbox" name="rule_ids[]" value="{$v['id']}" <if condition="in_array($v['id'],$group_data['rules'])">	checked="checked"</if> onclick="checkAll(this)">
                        </label>
                    </th>
                    <td class="b-child">
                        <foreach name="v['_data']" item="n">
                            <table class="table table-striped table-bordered table-hover table-condensed">
                                <tr class="b-group">
                                    <th width="10%">
                                        <label>
                                            {$n['title']} <input type="checkbox" name="rule_ids[]" value="{$n['id']}" <if condition="in_array($n['id'],$group_data['rules'])">	checked="checked"</if> onclick="checkAll(this)">
                                        </label>
                                    </th>
                                    <td>
                                        <notempty name="n['_data']">
                                            <volist name="n['_data']" id="c">
                                                <label>
                                                    &emsp;{$c['title']} <input type="checkbox" name="rule_ids[]" value="{$c['id']}" <if condition="in_array($c['id'],$group_data['rules'])">	checked="checked"</if> >
                                                </label>
                                            </volist>
                                        </notempty>
                                    </td>
                                </tr>
                            </table>
                        </foreach>
                    </td>
                </tr>
            </empty>
        </foreach>
        <tr>
            <th></th>
            <td>
                <input class="btn btn-success" type="submit" value="提交">
            </td>
        </tr>
    </table>
</form>
<script src="__ADMINJS__/jquery.min.js?v=2.1.4"></script>
<script src="__ADMINJS__/bootstrap.min.js?v=3.3.6"></script>
<script src="__ADMINJS__/content.js?v=1.0.0"></script>
<script src="__ADMINJS__/plugins/treeview/bootstrap-treeview.js"></script>
<script>
    function checkAll(obj){
        $(obj).parents('.b-group').eq(0).find("input[type='checkbox']").prop('checked', $(obj).prop('checked'));
    }
</script>
</body>
</html>
